<%-- 
    Document   : EditarAgenda
    Created on : 16/11/2013, 21:01:42
    Author     : Eduarda
--%>

<%@page import="model.Paciente"%>
<%@page import="model.Compromisso"%>
<%@page import="model.Agenda"%>
<%@page import="model.Profissional"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>        
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <title>Clínica Médica - Sua saúde em primeiro lugar</title>        
    </head>
    <body>
        <div class="container">
            <jsp:include page="cabecalho.jsp" flush="true" />       
            <div class="content">
                <div class="panel panel-default espaco-form">                    
                    <div class="row">
                        <div class="col-md-10">
                            <h3>Editar Compromisso</h3>
                        </div>
                        <div class="col-md-2">
                            <a class="btn btn-success pull-right espaco-botao" href="javascript:history.back(1)" title="Voltar">Voltar</a>                    
                        </div>                        
                    </div>        
                    <br>
                    <form method="POST" class="cadastros" action="FrontController">
                        <%Compromisso com = (Compromisso) session.getAttribute("com2");%>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-nome-c">Nome:</label>        
                           </div>
                           <div class="col-md-4">                           
                              <input class="input-text" id="informa-nome-c" type="text" name="nome" required value="<%=com.getNome()%>">
                           </div>
                        </div>                        
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-desc-c">Descrição:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-desc-c" type="text" name="descricao" required value="<%=com.getDescricao()%>">
                           </div>
                        </div>                    
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-data-c">Data:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-data-c" type="text" name="data" required value="<%=com.getData()%>">
                           </div>
                        </div> 
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-hora-c">Hora:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-hora-c" type="text" name="hora" required value="<%=com.getHora()%>">
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-paciente">Paciente:</label>        
                           </div>
                           <div class="col-md-4">
                               <select class="input-text" id="informa-paciente" name="paciente" required>
                                    <% 
                                    ArrayList listaPaciente = (ArrayList) session.getAttribute("listaPacientes");                            
                                    Iterator it2 = listaPaciente.iterator();                            
                                    while (it2.hasNext()) {
                                        Paciente pac = (Paciente) it2.next();
                                        int idPessoa = pac.getPessoa().getIdPessoa();
                                        String nome = pac.getPessoa().getNome();

                                        System.out.println("Paciente: " + pac.getIdPessoa()+ " - " + pac.getNome());
                                    %>                            
                                    <option value="<%=idPessoa%>"><%=nome%></option>                            
                                    <% } // Fecha o while%>        
                                </select> 
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-compareceu">Compareceu:</label>        
                           </div>
                           <div class="col-md-4">
                                <select class="input-text" id="informa-compareceu" name="compareceu" required>
                                     <option value="S">Sim</option>
                                     <option value="N">Não</option>
                                </select> 
                           </div>
                        </div>                        
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-email">Valor:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-valor" type="text" name="valor" required value="<%=com.getValor()%>">
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-crm">Pago:</label>        
                           </div>
                           <div class="col-md-4">
                               <select class="input-text" id="informa-agenda" name="pagamento" required value="<%=com.getPagamento()%>">
                                    <option value="S">Sim</option>
                                    <option value="N">Não</option>
                               </select> 
                           </div>
                        </div>                                            
                        <div class="row">
                           <div class="col-md-4">                                                           
                               <input class="input-submit pull-right button-ok" type="submit" value="Salvar"> 
                               <input class="input-limpar pull-right button-ok" type="button" value="Cancelar" onClick="history.back()">                                                        
                           </div>
                        </div>   
                            <input type="hidden" name="idCompromisso" value="<%=com.getIdCompromisso()%>">
                            <input type="hidden" name="servlet" value="UpdateCompromisso">    
                    </form>                       
                </div>
            </div>  
            <jsp:include page="rodape.jsp" flush="true" />
        </div>        
    </body>
</html>

